$(function(){
		$.init();
//	  var url = window.location.href;
//	  var page = url.split('#')[1];
//	  if(page){
//		  loadBody(page);
//	  }else{
//		  loadBody("body/home_body.html");
//	  }
	  //$.router.load("body/home_body.html");
	  //系统级菜单
	  $('.hor-menu ul li').click(function(){
		  $('.hor-menu ul li').removeClass('active');
		  $(this).addClass('active');
	  });
	  
	  //二三级菜单
	  $('.nav-link').each(function(i,m){return;
		  var url = $(this).attr('href');
		  if(url.indexOf('html')<0) return;
		  $(m).click(function(){
			  //取消原来选中的菜单
			  $('.active a .selected','.page-sidebar-menu').remove();
			  $('.active a .arrow','.page-sidebar-menu').attr('class','arrow ');
			  $('.active','.page-sidebar-menu').attr('class','nav-item ');
			  
			  //选中新的菜单
			  $(this).append('<span class="selected"></span>');
			  $(this).parent().attr('class','nav-item start active open');
			  var pp = $(this).parent().parent().parent();
			  pp.attr('class','nav-item start active open');
			  pp.children().eq(0).find('arrow').attr('class','arrow open');
			  pp.children().eq(0).append('<span class="selected"></span>');
			  
			  //去掉href
			  $(this).attr('href','javascript:void(0);');
			  $.router.load(url);
			  //loadBody(url);
		  });
	  });
});

function loadBody(url){
	  var page = window.location.href.split('#')[0]+'#'+url;
	  window.location.href = page;
	  url = '..'+url;
	  $.get(url, function(result){
		  var html = $(result).find('.page-content').html();
		  if(html){
			  $('.page-content').html(html);
			  $('body').append('<script src="../../assets/pages/scripts/table-datatables-managed.min.js" type="text/javascript"></script>');
		  }else{
			  $('.page-content').html(result);
		  }
	  });
}